﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Data;

namespace BlueMonkey
{
    public class IntTimeConverterFormatter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            //
            double num = (double)value;
            TimeSpan time = TimeSpan.FromSeconds(num);
            string hrs, min, sec;

            hrs = time.Hours > 9 ? time.Hours.ToString() : ("0" + time.Hours);
            min = time.Minutes > 9 ? time.Minutes.ToString() : ("0" + time.Minutes);
            sec = time.Seconds > 9 ? time.Seconds.ToString() : ("0" + time.Seconds);

            return string.Format("{0}:{1}:{2}", hrs, min, sec);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
